<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="generator" content="ApiGen; http://apigen.org" />

	<title>Class Nette\String</title>

	<link rel="stylesheet" href="resources/style.css?v=2011071314" type="text/css" media="all" />
	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
	<link rel="search" href="opensearch.xml" type="application/opensearchdescription+xml" title="Nette Framework API documentation" />
	<script type="text/javascript" src="resources/combined.js"></script>
	<script type="text/javascript" src="allclasses.js"></script>
</head>

<body>
<div id="left">
	<a href="allclasses.html">All Classes</a>

	<h3>Namespaces</h3>
	<ul>
		<li><a href="namespace-none.html">none</a>
		</li>
		<li class="active"><a href="namespace-Nette.html">Nette</a>
		</li>
		<li><a href="namespace-Nette.Application.html">Nette\Application</a>
		</li>
		<li><a href="namespace-Nette.Caching.html">Nette\Caching</a>
		</li>
		<li><a href="namespace-Nette.Collections.html">Nette\Collections</a>
		</li>
		<li><a href="namespace-Nette.Config.html">Nette\Config</a>
		</li>
		<li><a href="namespace-Nette.Forms.html">Nette\Forms</a>
		</li>
		<li><a href="namespace-Nette.IO.html">Nette\IO</a>
		</li>
		<li><a href="namespace-Nette.Loaders.html">Nette\Loaders</a>
		</li>
		<li><a href="namespace-Nette.Mail.html">Nette\Mail</a>
		</li>
		<li><a href="namespace-Nette.Reflection.html">Nette\Reflection</a>
		</li>
		<li><a href="namespace-Nette.Security.html">Nette\Security</a>
		</li>
		<li><a href="namespace-Nette.Templates.html">Nette\Templates</a>
		</li>
		<li><a href="namespace-Nette.Web.html">Nette\Web</a>
		</li>
		<li><a href="namespace-PHP.html">PHP</a>
		</li>
	</ul>

	<hr />

	<h3>Classes</h3>

	<ul>
		<li><a href="Nette.ArrayTools.html">ArrayTools</a></li>
		<li><a href="Nette.Callback.html">Callback</a></li>
		<li><a href="Nette.Component.html">Component</a></li>
		<li><a href="Nette.ComponentContainer.html">ComponentContainer</a></li>
		<li><a href="Nette.Configurator.html">Configurator</a></li>
		<li><a href="Nette.DateTime.html">DateTime</a></li>
		<li><a href="Nette.Debug.html">Debug</a></li>
		<li><a href="Nette.Environment.html">Environment</a></li>
		<li><a href="Nette.Framework.html">Framework</a></li>
		<li><a href="Nette.FreezableObject.html">FreezableObject</a></li>
		<li><a href="Nette.GenericRecursiveIterator.html">GenericRecursiveIterator</a></li>
		<li><a href="Nette.Image.html">Image</a></li>
		<li><a href="Nette.ImageMagick.html">ImageMagick</a></li>
		<li><a href="Nette.InstanceFilterIterator.html">InstanceFilterIterator</a></li>
		<li><a href="Nette.Object.html">Object</a></li>
		<li><a href="Nette.ObjectMixin.html">ObjectMixin</a></li>
		<li><a href="Nette.Paginator.html">Paginator</a></li>
		<li><a href="Nette.RecursiveComponentIterator.html">RecursiveComponentIterator</a></li>
		<li><a href="Nette.ServiceLocator.html">ServiceLocator</a></li>
		<li><a href="Nette.SmartCachingIterator.html">SmartCachingIterator</a></li>
		<li class="active"><a href="Nette.String.html">String</a></li>
		<li><a href="Nette.Tools.html">Tools</a></li>
	</ul>

	<h3>Interfaces</h3>

	<ul>
		<li><a href="Nette.IComponent.html">IComponent</a></li>
		<li><a href="Nette.IComponentContainer.html">IComponentContainer</a></li>
		<li><a href="Nette.IDebuggable.html">IDebuggable</a></li>
		<li><a href="Nette.IServiceLocator.html">IServiceLocator</a></li>
		<li><a href="Nette.ITranslator.html">ITranslator</a></li>
	</ul>

	<h3>Exceptions</h3>

	<ul>
		<li><a href="Nette.AmbiguousServiceException.html">AmbiguousServiceException</a></li>
	</ul>
</div>

<div id="right">
	<form action="http://www.google.com/cse" id="search" onsubmit="if(this.q.value.indexOf('more:')==-1)this.q.value+=' more:api'">
		<input type="hidden" name="cx" value="011549293477758430224:vxofa9ufnhc" /><input type="hidden" name="ie" value="UTF-8" /><input type="text" name="q" class="text" /><input type="submit" value="Search" />
	</form>

<div id="navigation">
	<ul>
		<li><a href="overview.html" title="Summary of all namespaces">Overview</a></li>
		<li><a href="namespace-Nette.html" title="Summary of Nette">Namespace</a></li>
		<li class="active">Class</li>
		<li><a href="elements.html">Elements</a></li>
	</ul>
</div>

<div id="content">
	<div id="classSummary">
		<p>namespace <a href="namespace-Nette.html">Nette</a></p>

		<h1>Class String</h1>

		<div class="classDescription">
		
<p>String tools library.</p>

		</div>




		<div class="classInfo">
			<b>Final Class</b><br />
				<b>Author:</b> David Grudl<br />
			<b>Located at</b> <a href="source-Utils.String.php.html#18">/Utils/String.php</a><br />
		</div>
	</div>


	<div id="methodSummary">
		<table class="summary">
		<caption>Method Summary</caption>
		<tr data-order="1 __construct" id="___construct">
			<td align="right" width="1%"><code class="nowrap">
				final public 
				
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#___construct">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#26" title="go to source code"><b>__construct</b></a>(
			)</code>

			<div class="short">
				
<p>Static class – cannot be instantiated.</p>

			</div>

			<div class="detailed">
				
<p>Static class – cannot be instantiated.</p>






			</div>
			</td>
		</tr>
		<tr data-order="0 checkEncoding" id="_checkEncoding">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				bool
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_checkEncoding">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#36" title="go to source code"><b>checkEncoding</b></a>(
					string
					<var>$s</var>, 
					string
					<var>$encoding</var> = <span class="php-quote">'UTF-8'</span>
			)</code>

			<div class="short">
				
<p>Checks if the string is valid for the specified encoding.</p>

			</div>

			<div class="detailed">
				
<p>Checks if the string is valid for the specified encoding.</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$s</code> string byte stream to check<br />
						<code>$encoding</code> string expected encoding<br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">bool </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 fixEncoding" id="_fixEncoding">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				string
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_fixEncoding">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#49" title="go to source code"><b>fixEncoding</b></a>(
					string
					<var>$s</var>, 
					string
					<var>$encoding</var> = <span class="php-quote">'UTF-8'</span>
			)</code>

			<div class="short">
				
<p>Returns correctly encoded string.</p>

			</div>

			<div class="detailed">
				
<p>Returns correctly encoded string.</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$s</code> string byte stream to fix<br />
						<code>$encoding</code> string encoding<br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">string </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 chr" id="_chr">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				string
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_chr">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#64" title="go to source code"><b>chr</b></a>(
					int
					<var>$code</var>, 
					string
					<var>$encoding</var> = <span class="php-quote">'UTF-8'</span>
			)</code>

			<div class="short">
				
<p>Returns a specific character.</p>

			</div>

			<div class="detailed">
				
<p>Returns a specific character.</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$code</code> int codepoint<br />
						<code>$encoding</code> string encoding<br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">string </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 startsWith" id="_startsWith">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				bool
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_startsWith">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#77" title="go to source code"><b>startsWith</b></a>(
					string
					<var>$haystack</var>, 
					string
					<var>$needle</var>
			)</code>

			<div class="short">
				
<p>Starts the $haystack string with the prefix $needle?</p>

			</div>

			<div class="detailed">
				
<p>Starts the $haystack string with the prefix $needle?</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$haystack</code> string <br />
						<code>$needle</code> string <br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">bool </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 endsWith" id="_endsWith">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				bool
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_endsWith">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#90" title="go to source code"><b>endsWith</b></a>(
					string
					<var>$haystack</var>, 
					string
					<var>$needle</var>
			)</code>

			<div class="short">
				
<p>Ends the $haystack string with the suffix $needle?</p>

			</div>

			<div class="detailed">
				
<p>Ends the $haystack string with the suffix $needle?</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$haystack</code> string <br />
						<code>$needle</code> string <br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">bool </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 normalize" id="_normalize">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				string
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_normalize">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#103" title="go to source code"><b>normalize</b></a>(
					string
					<var>$s</var>
			)</code>

			<div class="short">
				
<p>Removes special controls characters and normalizes line endings and
spaces.</p>

			</div>

			<div class="detailed">
				
<p>Removes special controls characters and normalizes line endings and
spaces.</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$s</code> string UTF-8 encoding or 8-bit<br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">string </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 webalize" id="_webalize">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				string
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_webalize">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#128" title="go to source code"><b>webalize</b></a>(
					string
					<var>$s</var>, 
					string
					<var>$charlist</var> = <span class="php-keyword1">NULL</span>, 
					bool
					<var>$lower</var> = <span class="php-keyword1">true</span>
			)</code>

			<div class="short">
				
<p>Converts to web safe characters [a-z0–9-] text.</p>

			</div>

			<div class="detailed">
				
<p>Converts to web safe characters [a-z0–9-] text.</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$s</code> string UTF-8 encoding<br />
						<code>$charlist</code> string ASCII<br />
						<code>$lower</code> bool <br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">string </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 truncate" id="_truncate">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				string
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_truncate">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#155" title="go to source code"><b>truncate</b></a>(
					string
					<var>$s</var>, 
					int
					<var>$maxLen</var>, 
					string
					<var>$append</var> = <span class="php-quote">'…'</span>
			)</code>

			<div class="short">
				
<p>Truncates string to maximal length.</p>

			</div>

			<div class="detailed">
				
<p>Truncates string to maximal length.</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$s</code> string UTF-8 encoding<br />
						<code>$maxLen</code> int <br />
						<code>$append</code> string UTF-8 encoding<br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">string </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 indent" id="_indent">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				string
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_indent">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#181" title="go to source code"><b>indent</b></a>(
					string
					<var>$s</var>, 
					int
					<var>$level</var> = <span class="php-num">1</span>, 
					string
					<var>$chars</var> = <span class="php-quote">'	'</span>
			)</code>

			<div class="short">
				
<p>Indents the content from the left.</p>

			</div>

			<div class="detailed">
				
<p>Indents the content from the left.</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$s</code> string UTF-8 encoding or 8-bit<br />
						<code>$level</code> int <br />
						<code>$chars</code> string <br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">string </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 lower" id="_lower">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				string
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_lower">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#195" title="go to source code"><b>lower</b></a>(
					string
					<var>$s</var>
			)</code>

			<div class="short">
				
<p>Convert to lower case.</p>

			</div>

			<div class="detailed">
				
<p>Convert to lower case.</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$s</code> string UTF-8 encoding<br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">string </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 upper" id="_upper">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				string
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_upper">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#207" title="go to source code"><b>upper</b></a>(
					string
					<var>$s</var>
			)</code>

			<div class="short">
				
<p>Convert to upper case.</p>

			</div>

			<div class="detailed">
				
<p>Convert to upper case.</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$s</code> string UTF-8 encoding<br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">string </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 capitalize" id="_capitalize">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				string
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_capitalize">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#219" title="go to source code"><b>capitalize</b></a>(
					string
					<var>$s</var>
			)</code>

			<div class="short">
				
<p>Capitalize string.</p>

			</div>

			<div class="detailed">
				
<p>Capitalize string.</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$s</code> string UTF-8 encoding<br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">string </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 trim" id="_trim">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				string
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_trim">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#231" title="go to source code"><b>trim</b></a>(
					string
					<var>$s</var>, 
					string
					<var>$charlist</var> = <span class="php-quote">' 	
'</span> . <span class="php-quote">&quot;\0&quot;</span> . <span class="php-quote">' '</span>
			)</code>

			<div class="short">
				
<p>Strips whitespace.</p>

			</div>

			<div class="detailed">
				
<p>Strips whitespace.</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$s</code> string UTF-8 encoding<br />
						<code>$charlist</code> string <br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">string </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 padLeft" id="_padLeft">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				string
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_padLeft">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#245" title="go to source code"><b>padLeft</b></a>(
					string
					<var>$s</var>, 
					int
					<var>$length</var>, 
					string
					<var>$pad</var> = <span class="php-quote">' '</span>
			)</code>

			<div class="short">
				
<p>Pad a string to a certain length with another string.</p>

			</div>

			<div class="detailed">
				
<p>Pad a string to a certain length with another string.</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$s</code> string UTF-8 encoding<br />
						<code>$length</code> int <br />
						<code>$pad</code> string <br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">string </div>


			</div>
			</td>
		</tr>
		<tr data-order="0 padRight" id="_padRight">
			<td align="right" width="1%"><code class="nowrap">
				 public static
				string
				
				</code>
			</td>

			<td>
			<a class="anchor" href="#_padRight">#</a>
			<code class="nowrap">
				<a href="source-Utils.String.php.html#261" title="go to source code"><b>padRight</b></a>(
					string
					<var>$s</var>, 
					int
					<var>$length</var>, 
					string
					<var>$pad</var> = <span class="php-quote">' '</span>
			)</code>

			<div class="short">
				
<p>Pad a string to a certain length with another string.</p>

			</div>

			<div class="detailed">
				
<p>Pad a string to a certain length with another string.</p>



					<h4>Parameters</h4>
					<div class="smallList">
						<code>$s</code> string UTF-8 encoding<br />
						<code>$length</code> int <br />
						<code>$pad</code> string <br />
					</div>

					<h4>Returns</h4>
					<div class="smallList">string </div>


			</div>
			</td>
		</tr>

		</table>
	</div>









</div>

	<div id="footer">
		Nette Framework API documentation generated by <a href="http://apigen.org">ApiGen</a>
	</div>
</div>
</body>
</html>
